﻿
using Microsoft.EntityFrameworkCore;
using SIMS.Shared.DTO;

namespace SIMS.WebApi.Data
{
    public class DataContext: DbContext
    {
        public DbSet<UserDTO> Users { get; set; }

        public DbSet<MenuDTO> Menus { get; set; }

        public DbSet<RoleDTO> Roles { get; set; }

        public DbSet<UserRoleDTO> UserRoles { get; set; }

        public DbSet<RoleMenuDTO> RoleMenus { get; set; }

        public DbSet<StudentDTO> Students { get; set; }

        public DbSet<ClassesDTO> Classes { get; set; }

        public DbSet<CourseDTO> Courses { get; set; }

        public DbSet<ScoreDTO> Scores { get; set; }

        public DataContext(DbContextOptions options) : base(options)
        {

        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Entity<UserDTO>().ToTable("Users");
            modelBuilder.Entity<MenuDTO>().ToTable("Menus");
            modelBuilder.Entity<StudentDTO>().ToTable("Students");
            modelBuilder.Entity<RoleDTO>().ToTable("Roles");
            modelBuilder.Entity<UserRoleDTO>().ToTable("UserRoles");
            modelBuilder.Entity<RoleMenuDTO>().ToTable("RoleMenus");
        }
    }
}
